
#include<string.h>
#include<stdio.h>
int main()
{
    //freopen("in.txt","r",stdin);
    char str[105];
    char p[105];
    scanf("%s %s",str,p);
    int str_len = strlen(str);
    int p_len = strlen(p);
    int i = 0;
    int j = 0;
    int flag = 0;
    int count = 0;
    while (1)
    {
        count++;
        if(count == 10000) 
        {
            printf("No");
            break;
        }
        if(str[i] == p[j])
        {
            flag = 1;
            while (j < p_len)
            {
                if(str[i] != p[j]) 
                {
                    flag = 0;
                    j = 0;
                    break;
                }
                else
                {
                    i++;
                    i = i % str_len;
                    j++;
                }
            }
            if(flag == 1)
            {
                printf("Yes");
                break;
            }
        }
        else
        {
            i++;
            i = i %str_len;
            j = 0;
        }
    }
    
}